package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.heart.service.IActTaskCommentService;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ActTaskCommentMapper;
import com.ly.heart.domain.ActTaskCommentEntity;

import javax.annotation.Resource;

/**
 * 流程任务审核记录Service业务层处理
 *
 * @author cxl
 * @date 2024-05-30
 */
@Service
public class ActTaskCommentServiceImpl extends ServiceImpl<ActTaskCommentMapper, ActTaskCommentEntity> implements IActTaskCommentService {

    @Resource
    private ActTaskCommentMapper taskCommentMapper;

    /**
     * 查询流程任务审核记录
     *
     * @param id 流程任务审核记录ID
     * @return 流程任务审核记录
     */
    @Override
    public ActTaskCommentEntity selectTaskCommentEntityById ( String id ) {
        return taskCommentMapper.selectTaskCommentEntityById ( id );
    }

    /**
     * 查询流程任务审核记录列表
     *
     * @param taskCommentEntity 流程任务审核记录
     * @return 流程任务审核记录
     */
    @Override
    public List<ActTaskCommentEntity> selectTaskCommentEntityList ( ActTaskCommentEntity taskCommentEntity ) {
        return taskCommentMapper.selectTaskCommentEntityList ( taskCommentEntity );
    }

    /**
     * 新增流程任务审核记录
     *
     * @param taskCommentEntity 流程任务审核记录
     * @return 结果
     */
    @Override
    public int insertTaskCommentEntity ( ActTaskCommentEntity taskCommentEntity ) {
        taskCommentEntity.setCreateTime ( DateUtils.getNowDate () );
        return taskCommentMapper.insertTaskCommentEntity ( taskCommentEntity );
    }

    /**
     * 修改流程任务审核记录
     *
     * @param taskCommentEntity 流程任务审核记录
     * @return 结果
     */
    @Override
    public int updateTaskCommentEntity ( ActTaskCommentEntity taskCommentEntity ) {
        return taskCommentMapper.updateTaskCommentEntity ( taskCommentEntity );
    }

    /**
     * 批量删除流程任务审核记录
     *
     * @param ids 需要删除的流程任务审核记录ID
     * @return 结果
     */
    @Override
    public int deleteTaskCommentEntityByIds ( String[] ids ) {
        return taskCommentMapper.deleteTaskCommentEntityByIds ( ids );
    }

    /**
     * 删除流程任务审核记录信息
     *
     * @param id 流程任务审核记录ID
     * @return 结果
     */
    @Override
    public int deleteTaskCommentEntityById ( String id ) {
        return taskCommentMapper.deleteTaskCommentEntityById ( id );
    }

    /**
     * 通过实例Id查询最后一个审批人
     * @param instanceId：业务表中的实例Id
     * @return：最新审批记录
     */
    @Override
    public ActTaskCommentEntity queryLastComment ( String instanceId ) {
        ActTaskCommentEntity actTaskCommentEntity = taskCommentMapper.queryLastComment ( instanceId );
        return actTaskCommentEntity;
    }

}
